package com.zsw.dao;

import com.zsw.entity.Order;
import org.apache.ibatis.annotations.*;

/**
 * @author zhangsw
 */
public interface OrderDao {

    /**
     * 插入订单
     * @param order
     * @return
     */
    @Insert("insert into `order` (`user_id`,`commodity_code`,`count`,`money`,`status`) values (#{userId},#{commodityCode},#{count},#{money},#{status})")
    @Options(useGeneratedKeys = true,keyProperty = "id",keyColumn = "id")
    int insertOrder(Order order);


    /**
     * 根据Id获取订单
     * @param orderId
     * @return
     */
    @Select("select `id`,`user_id`,`commodity_code`,`count`,`money`,`status` from `order` where id=#{id}")
    Order getOrderById(@Param(value = "id") Integer orderId);
}
